#include "UISender.h"
#include "mmcogtestmsg.h"
#include "TestProgressControl.pb.h"
#include "VoiceControl.pb.h"

UISender::UISender()
{
}


UISender::~UISender()
{
}

void UISender::SendInitTest()
{
	TestProgressControl* testProgressControl = new TestProgressControl;
	testProgressControl->set_test_cmd(TestProgressControl_Command_TEST_INIT);
	SendMsg(UI_SENDER, UI_LIB_MSG_TEST_PROGRESS_CONTROL, testProgressControl);
}

void UISender::SendStartTest(QVector<int> ids)
{
	TestProgressControl* control = new TestProgressControl;
	control->set_test_cmd(TestProgressControl_Command_TEST_START);
	QVector<int>::iterator it = ids.begin();
	for (; it != ids.end(); ++it) {
		control->add_test_id(*it);
	}
	SendMsg(UI_SENDER, UI_LIB_MSG_TEST_PROGRESS_CONTROL, control);
}

void UISender::SendStopTest()
{

}

void UISender::SendVoicePlay(QString path)
{
	VoiceControl* voiceControl = new VoiceControl;
	voiceControl->set_cmd(VoiceControl_Command_VOICE_PLAY);
	voiceControl->mutable_play_param()->set_file_path(path.toStdString());
	SendMsg(UI_SENDER, UI_LIB_MSG_VOICE_CONTROL, voiceControl);
}
